<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>5.6 *函数</title>
</head>

<body>
    <script>
        function fn(n) {
            for (var i = 0; i < n; i++) {
                for (var j = 0; j < (n - 1 - i); j++) {
                    document.write('&nbsp;')
                }
                for (var k = 0; k <= i; k++) {
                    document.write('* ')
                }
                document.write('<br>');
            }
        }
        fn(17);
    </script>
</body>

</html>